package com.whut.service.impl;

import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whut.mapper.*;
import com.whut.model.*;
import com.whut.parMapper.ParProblemCollectDetailMapper;
import com.whut.parMapper.ParProblemDescriptionMapper;
import com.whut.parMapper.ParSystemMapper;
import com.whut.parMapper.utils.MapperUtils;
import com.whut.report.*;
import com.whut.service.CheckInfoService;
import com.whut.utils.FileUtil;
import com.whut.utils.MDoc;
import com.whut.utils.pointsCalculate;
import com.whut.v_model.PCDandUSERNAME;
import com.whut.v_model.ProblemCollectDetail;
import com.whut.v_vo.*;
import org.apache.commons.lang3.StringUtils;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtils;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.awt.*;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;

@Service("checkInfoService")
public class CheckInfoServiceImpl implements CheckInfoService {
    @Resource
    private ContractchecktaskMapper contractchecktaskMapper;
    @Resource
    private ContracttaskprojectMapper contractTaskProjectMapper;
    @Resource
    private EquipinfoMapper equipinfoMapper;
    @Resource
    private ProblemCollectDetailMapper problemCollectDetailMapper;
    @Resource
    private NewProblemCollectDetailMapper newProblemCollectDetailMapper;
    @Resource
    private NewPrefixSystemMapper newprefixsystemMapper;
    @Resource
    private ProblemDescriptionMapper problemdescriptionMapper;
    @Resource
    private SummaryMapper summaryMapper;
    @Resource
    private UncheckeditemsMapper uncheckeditemsMapper;
    @Resource
    private ContractinfoMapper contractinfoMapper;
    @Resource
    private PointlimitMapper pointlimitMapper;
    @Resource
    private AllpointsaveMapper allpointsaveMapper;
    @Resource
    private ProblemcollectMapper problemcollectMapper;
    @Resource
    private NoproblemitemMapper noproblemitemMapper;
    @Resource
    private EditableweightpsMapper editableweightpsMapper;
    @Resource
    private NewProblemDescriptionMapper newproblemdescriptionMapper;
    @Resource
    private ResultsinglechildMapper resultsinglechildMapper;
    @Resource
    private NewfuzzyresultMapper newfuzzyresultMapper;
    @Resource
    private UncheckSysPointMapper uncheckSysPointMapper;
    @Resource
    private PrefixParSystemMapper prefixParSystemMapper;
    @Resource
    private UrlProperties urlProperties;
    @Resource
    private NewPrefixSystemMapper newPrefixSystemMapper;
    @Resource
    private MapperUtils mapperUtils;
    @Resource
    private Profiles profiles;
    @Resource
    private PrefixsystemMapper prefixsystemMapper;

    @Resource
    private ReportServiceImpl reportServiceImpl;

    public static final String IMG_PATH = "D:\\whutServer\\generatedCharts\\";

    public static final String TEST_IMG_PATH = IMG_PATH + "test.png";

    @Override
    public Object getCheckInfoByPage(String startTime, String endTime, int curPage, int pageSize, String checkState,
                                     String startTimeY, String endTimeY, int client, String projectName) {
        PageHelper.startPage(curPage, pageSize);
        List<ContractCheckTask> list = new ArrayList<ContractCheckTask>();
        if (checkState.equals("1")) {
            switch (client) {
                case 0:
                    list = contractchecktaskMapper.getTaskByFinishTime(startTime, endTime, projectName);
                    break;
                default:
                    list = contractchecktaskMapper.getTaskByFinishTimeAndClient(startTime, endTime, client, projectName);
                    break;
            }
        } else if (checkState.equals("N")) {
            switch (client) {
                case 0:
                    list = contractchecktaskMapper.getTaskByCheckState(startTime, endTime, checkState, projectName);
                    break;
                default:
                    list = contractchecktaskMapper.getTaskByCheckStateAndClient(startTime, endTime, checkState, client, projectName);
                    break;
            }
        } else if (checkState.equals("Y")) {
            switch (client) {
                case 0:
                    list = contractchecktaskMapper.getTaskByCheckStateY(startTimeY, endTimeY, checkState, projectName);
                    break;
                default:
                    list = contractchecktaskMapper.getTaskByCheckStateYAndClient(startTime, endTime, checkState, client, projectName);
                    break;
            }
        }
        PageInfo result = new PageInfo(list);
        return result;
    }

    @Override
    public String test() throws UnsupportedEncodingException {

        Map<String, Object> dataMap = new HashMap<String, Object>();
        List<Object> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Map<String, Object> map1 = new HashMap<>();
            dataMap.put("pic1", 1);
        }
        MDoc mdoc = new MDoc();
        mdoc.createDoc(dataMap, "D:\\WYH.doc", "ftl\\test.ftl");
        String result = "D:\\heihei.doc";
        System.out.println("成功生成模板");
        return result;

    }

    /**
     * 生成报告模块
     *
     * @param projectId
     * @param checkId
     * @param reportType
     * @return
     * @throws Exception
     */
    @Override
    public String generateCheckReport(int projectId, int checkId, int reportType, boolean isNew) throws Exception {
        ParSystemMapper parSystemMapper = isNew ? newPrefixSystemMapper : prefixParSystemMapper;
        ParProblemDescriptionMapper parProblemDescriptionMapper = isNew ? newproblemdescriptionMapper : problemdescriptionMapper;
        ParProblemCollectDetailMapper parProblemCollectDetailMapper = isNew ? newProblemCollectDetailMapper : problemCollectDetailMapper;

        return new CheckReport(parSystemMapper,
                parProblemDescriptionMapper,
                parProblemCollectDetailMapper,
                this,
                reportServiceImpl,
                mapperUtils,
                urlProperties,
                profiles).generateCheckReport(projectId, checkId, reportType, isNew);
    }

    private double calculateAllWeight4Func(int checkId, JSONObject part2InnerObject) {
        double allweight4 = 0;
        Integer taskId = contractchecktaskMapper.getTaskIdByCheckId(checkId);
        List<ProblemCollectDetail> countFourthWeight = problemCollectDetailMapper.getAllFourthInfoMXTQ(checkId, part2InnerObject.getIntValue("thirdId"));
        for (int v = 0; v < countFourthWeight.size(); v++) {
            double Tweight4 = 0;
            int fourthId = countFourthWeight.get(v).getFourthId();
//            String trueweight4 = prefixParSystemMapper.getWeight3ByThirdId(fourthId);
//            Tweight4 = pointsCalculate.getPercentInstance(trueweight4);

            String newWeight4 = editableweightpsMapper.getWeightByNumber(fourthId, taskId);
            if (StringUtils.isNotBlank(newWeight4)) {
                Tweight4 = pointsCalculate.getPercentInstance(newWeight4);
            } else {
                String trueweight4 = prefixParSystemMapper.getWeight3ByThirdId(fourthId);
                Tweight4 = pointsCalculate.getPercentInstance(trueweight4);
            }

            allweight4 += Tweight4;
        }
        return allweight4;
    }

    private String getCheckItemPointAndUpdateAllPointSave(int checkId, int part2FourthId, int projectId, double checkItemPoint, DecimalFormat df) {
        List<ProblemCollectDetail> checkItemCalcuList = problemCollectDetailMapper.getAllFourthInfo(checkId, part2FourthId);
        String maxFourthRiskPoint = pointsCalculate.getMaxRiskPoint(checkItemCalcuList);
        int maxFourthRiskPointNum = problemCollectDetailMapper.getRiskPointCount(checkId, part2FourthId, maxFourthRiskPoint);
        double limitFourhPoint = Double.parseDouble((pointlimitMapper.getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint)) == null ? "100" : pointlimitMapper.getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint));
        if (checkItemPoint > limitFourhPoint) {
            checkItemPoint = limitFourhPoint;
        }
        String s = df.format(checkItemPoint);
        int allPointSaveFourthPointCount = allpointsaveMapper.getAllPointCountByCheckId(checkId, part2FourthId);
        if (allPointSaveFourthPointCount != 0) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date1 = new Date(System.currentTimeMillis());
            String lastEditTime = formatter.format(date1);
            allpointsaveMapper.updateAllPoint(checkId, s, part2FourthId, lastEditTime);
        } else {
            Allpointsave allpointsave = new Allpointsave();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date1 = new Date(System.currentTimeMillis());
            allpointsave.setNewCreateTime(formatter.format(date1));
            allpointsave.setLastEditTime(formatter.format(date1));
            allpointsave.setProjectId(projectId);
            allpointsave.setCheckId(checkId);
            allpointsave.setNumber(part2FourthId);
            allpointsave.setPoint(s);
            allpointsaveMapper.insert(allpointsave);
        }
        return s;
    }

    private double calculateNoProblemPointFunc(int checkId, JSONObject part2InnerObject) {
        double noProblemPoint = 0;
        List<Object> noProblemSixthIdList = uncheckeditemsMapper.getNoProblemSixthId(checkId, part2InnerObject.getIntValue("fourthId"));
        String noProblemSixthIdInfo = JSON.toJSONString(noProblemSixthIdList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray noProblemSixthArray = JSONArray.parseArray(noProblemSixthIdInfo);
        for (int m = 0; m < noProblemSixthArray.size(); m++) {
            int noProblemSixthId = noProblemSixthArray.getIntValue(m);
            double noProblem = Double.parseDouble(prefixParSystemMapper.getPoint4ByPoint4Id(noProblemSixthId));
            noProblemPoint += noProblem;
        }
        return noProblemPoint;
    }

    public String getPart2InnerListweight4(int checkId, int part2ThirdId, double weight3, double weight4, double allweight4) {
        //int countFourthId=prefixParSystemMapper.getCountFourth(part2ThirdId);
        List<Object> fourthCountList = problemCollectDetailMapper.getFourthCountList(checkId, part2ThirdId);
        String fourthCountInfo = JSON.toJSONString(fourthCountList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray fourthCountInfoArray = JSONArray.parseArray(fourthCountInfo);
        int countFourthId = fourthCountInfoArray.size();
        return pointsCalculate.double2ToPercent(weight3, allweight4 / weight4);
    }

    public List<Double> calculatePoint6Func(JSONArray sixthPointsArray, int checkId) {
        double calculatePoint66 = 0;
        double calculatePoint6 = 0;
        double calculateTruePoint = 0;
        for (int y = 0; y < sixthPointsArray.size(); y++) {
            JSONObject sixPointObject = sixthPointsArray.getJSONObject(y);
            int deductSixthId = sixPointObject.getIntValue("sixthId");
            System.out.println("sixId:" + deductSixthId);
            float deductPointsSumFloat = problemCollectDetailMapper.getdeductSum(checkId, deductSixthId);
            double deductPointsSum = Double.valueOf(String.valueOf(deductPointsSumFloat));
            double truePoint = Double.parseDouble(sixPointObject.getString("point6"));
            System.out.println("各类point:" + deductPointsSum + " " + truePoint);
            if (truePoint <= deductPointsSum) {
                calculatePoint66 = 0;
            } else {
                calculatePoint66 = truePoint - deductPointsSum;
            }
            calculateTruePoint += truePoint;  //体系分数
            calculatePoint6 += calculatePoint66;  //得分总和
        }
        List<Double> calculatePointList = new ArrayList<>();
        calculatePointList.add(calculateTruePoint);
        calculatePointList.add(calculatePoint6);
        System.out.println("计算point6:" + calculatePointList);
        return calculatePointList;
    }

    /**
     * 要改的  中建三局质量报告模板
     *
     * @param projectId
     * @param checkId
     * @return
     * @throws UnsupportedEncodingException
     */
    @Override
    public String generateQualityReportofCC3EB(int projectId, int checkId, boolean isNew) throws UnsupportedEncodingException {
        ParSystemMapper parSystemMapper = isNew ? newPrefixSystemMapper : prefixParSystemMapper;
        ParProblemDescriptionMapper parProblemDescriptionMapper = isNew ? newproblemdescriptionMapper : problemdescriptionMapper;
        ParProblemCollectDetailMapper parProblemCollectDetailMapper = isNew ? newProblemCollectDetailMapper : problemCollectDetailMapper;

        return new QualityReportofCC3EB(parSystemMapper,
                parProblemDescriptionMapper,
                parProblemCollectDetailMapper,
                this,
                reportServiceImpl,
                mapperUtils,
                urlProperties,
                profiles).generateReport(projectId, checkId, isNew);

    }

    @Override
    public String generateSpecialSafetyReport(int projectId, int checkId, boolean isNew) throws UnsupportedEncodingException {
        ParSystemMapper parSystemMapper = isNew ? newPrefixSystemMapper : prefixParSystemMapper;
        ParProblemDescriptionMapper parProblemDescriptionMapper = isNew ? newproblemdescriptionMapper : problemdescriptionMapper;
        ParProblemCollectDetailMapper parProblemCollectDetailMapper = isNew ? newProblemCollectDetailMapper : problemCollectDetailMapper;

        return new SpecialSafetyReport(parSystemMapper,
                parProblemDescriptionMapper,
                parProblemCollectDetailMapper,
                this,
                reportServiceImpl,
                mapperUtils,
                urlProperties,
                profiles).generateReport(projectId, checkId, isNew);

    }

    @Override
    public List<Object> getChooseInfo(int checkId) {
        List<Object> list = new ArrayList<Object>();
        List<Integer> pNname1InfoList = problemCollectDetailMapper.getAllName1Id(checkId);
        String pName1Info = JSON.toJSONString(pNname1InfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray pNname1InfoArray = JSONArray.parseArray(pName1Info);
        for (int i = 0; i < pNname1InfoArray.size(); i++) {
            List<Object> listName1 = new ArrayList<Object>();
            Map<String, Object> name1Map = new HashMap<String, Object>();
            int firstId = pNname1InfoArray.getIntValue(i);
            String pName1 = prefixParSystemMapper.getName4ByName4Id(firstId);
            List<Object> secondIdInfoList = problemCollectDetailMapper.getSecondId(checkId, pName1);
            String secondIdInfo = JSON.toJSONString(secondIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
            JSONArray secondIdInfoArray = JSONArray.parseArray(secondIdInfo);

            for (int j = 0; j < secondIdInfoArray.size(); j++) {
                List<Object> listName2 = new ArrayList<Object>();
                Map<String, Object> name2Map = new HashMap<String, Object>();
                int secondId = secondIdInfoArray.getIntValue(j);
                List<Object> thirdIdInfoList = problemCollectDetailMapper.getThirdId(checkId, pName1, secondId);
                String thirdIdInfo = JSON.toJSONString(thirdIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray thirdIdInfoArray = JSONArray.parseArray(thirdIdInfo);
                for (int k = 0; k < thirdIdInfoArray.size(); k++) {
                    List<Object> listName3 = new ArrayList<Object>();
                    Map<String, Object> name3Map = new HashMap<String, Object>();
                    int thirdId = thirdIdInfoArray.getIntValue(k);
                    List<Object> fourthIdInfoList = problemCollectDetailMapper.getFourthId(checkId, pName1, secondId, thirdId);
                    String fourthIdInfo = JSON.toJSONString(fourthIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                    JSONArray fourthIdInfoArray = JSONArray.parseArray(fourthIdInfo);
                    for (int l = 0; l < fourthIdInfoArray.size(); l++) {
                        Map<String, Object> name4Map = new HashMap<String, Object>();
                        int fourthId = fourthIdInfoArray.getIntValue(l);
                        String pName4 = prefixParSystemMapper.getName4ByName4Id(fourthId);
                        name4Map.put("value", fourthId);
                        name4Map.put("label", pName4);
                        listName3.add(name4Map);
                    }
                    String pName3 = prefixParSystemMapper.getName4ByName4Id(thirdId);
                    name3Map.put("value", thirdId);
                    name3Map.put("label", pName3);
                    name3Map.put("children", listName3);
                    listName2.add(name3Map);
                }
                String pName2 = prefixParSystemMapper.getName4ByName4Id(secondId);
                name2Map.put("value", secondId);
                name2Map.put("label", pName2);
                name2Map.put("children", listName2);
                listName1.add(name2Map);
            }
            name1Map.put("value", firstId);
            name1Map.put("label", pName1);
            name1Map.put("children", listName1);
            list.add(name1Map);
        }
        return list;
    }

    @Override
    public List<Object> getNewChooseInfo(int checkId) {
        List<Object> list = new ArrayList<Object>();
        List<Integer> pNname1InfoList = newProblemCollectDetailMapper.getAllName1Id(checkId);
        String pName1Info = JSON.toJSONString(pNname1InfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray pNname1InfoArray = JSONArray.parseArray(pName1Info);
        for (int i = 0; i < pNname1InfoArray.size(); i++) {
            List<Object> listName1 = new ArrayList<Object>();
            Map<String, Object> name1Map = new HashMap<String, Object>();
            int firstId = pNname1InfoArray.getIntValue(i);
            String pName1 = newprefixsystemMapper.getName4ByName4Id(firstId);
            List<Object> secondIdInfoList = newProblemCollectDetailMapper.getSecondId(checkId, pName1);
            String secondIdInfo = JSON.toJSONString(secondIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
            JSONArray secondIdInfoArray = JSONArray.parseArray(secondIdInfo);
            for (int j = 0; j < secondIdInfoArray.size(); j++) {
                List<Object> listName2 = new ArrayList<Object>();
                Map<String, Object> name2Map = new HashMap<String, Object>();
                int secondId = secondIdInfoArray.getIntValue(j);
                List<Object> thirdIdInfoList = newProblemCollectDetailMapper.getThirdId(checkId, pName1, secondId);
                String thirdIdInfo = JSON.toJSONString(thirdIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray thirdIdInfoArray = JSONArray.parseArray(thirdIdInfo);
                for (int k = 0; k < thirdIdInfoArray.size(); k++) {
                    List<Object> listName3 = new ArrayList<Object>();
                    Map<String, Object> name3Map = new HashMap<String, Object>();
                    int thirdId = thirdIdInfoArray.getIntValue(k);
                    List<Object> fourthIdInfoList = newProblemCollectDetailMapper.getFourthId(checkId, pName1, secondId, thirdId);
                    String fourthIdInfo = JSON.toJSONString(fourthIdInfoList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                    JSONArray fourthIdInfoArray = JSONArray.parseArray(fourthIdInfo);
                    for (int l = 0; l < fourthIdInfoArray.size(); l++) {
                        Map<String, Object> name4Map = new HashMap<String, Object>();
                        int fourthId = fourthIdInfoArray.getIntValue(l);
                        String pName4 = newprefixsystemMapper.getName4ByName4Id(fourthId);
                        name4Map.put("value", fourthId);
                        name4Map.put("label", pName4);
                        listName3.add(name4Map);
                    }
                    String pName3 = newprefixsystemMapper.getName4ByName4Id(thirdId);
                    name3Map.put("value", thirdId);
                    name3Map.put("label", pName3);
                    name3Map.put("children", listName3);
                    listName2.add(name3Map);
                }
                String pName2 = newprefixsystemMapper.getName4ByName4Id(secondId);
                name2Map.put("value", secondId);
                name2Map.put("label", pName2);
                name2Map.put("children", listName2);
                listName1.add(name2Map);
            }
            name1Map.put("value", firstId);
            name1Map.put("label", pName1);
            name1Map.put("children", listName1);
            list.add(name1Map);
        }
        return list;
    }

    @Override
    public List<? extends Object> getFourthInfo(int checkId, int fourthId, boolean isNew) {
        System.out.println("第四级Id：" + fourthId);
        System.out.println("检查Id：" + checkId);
        List<ProblemCollectDetail> problemCollectDetailList = isNew ? newProblemCollectDetailMapper.getAllFourthInfo(checkId, fourthId) : problemCollectDetailMapper.getAllFourthInfo(checkId, fourthId);
/*        List<ProblemCollectDetail> newProblemCollectDetailList=newProblemCollectDetailMapper.getAllFourthInfo(checkId,fourthId):newProblemCollectDetailMapper.getAllFourthInfo(checkId,fourthId);
        if(problemCollectDetailList.size()!=0){
            return problemCollectDetailList;
        }else {
            return newProblemCollectDetailList;
        }*/
        return problemCollectDetailList;
    }

    @Override
    public Object getContractInfoByPage(int curPage, int pageSize) {
        PageHelper.startPage(curPage, pageSize);
        List<Contractinfo> list = contractinfoMapper.getAllContractUnFinished();
        PageInfo result = new PageInfo(list);
        return result;
    }

    /*
     * @Author wenyihan
     * @Description 通过vague search查询合同信息
     * @Date 9:45 2019/6/20
     * @Param [curPage, pageSize, inputSearch]
     * @return java.lang.Object
     **/
    @Override
    public Object searchContractInfoByPage(int curPage, int pageSize, String inputSearch) {
        PageHelper.startPage(curPage, pageSize);
        List<Contractinfo> list = contractinfoMapper.getContractInfoByInput(inputSearch);
        PageInfo result = new PageInfo(list);
        return result;
    }

    @Override
    public String addContractInfo(Contractinfo contractinfo) {
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date = new Date(System.currentTimeMillis());
            contractinfo.setNewCreateTime(formatter.format(date));
            contractinfo.setLastEditTime(formatter.format(date));
            contractinfoMapper.insert(contractinfo);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String deleteContractInfo(int contractId) {
        try {
            contractinfoMapper.deleteByPrimaryKey(contractId);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String addPointLimitInfo(Pointlimit pointlimit) {
        try {
            pointlimitMapper.insert(pointlimit);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String editPointLimitInfo(Pointlimit pointlimit) {
        Pointlimit p = pointlimitMapper.selectByPrimaryKey(pointlimit.getMkey());
        System.out.println(pointlimit.getMkey() + "2333333333333333333" + p);
        try {
            pointlimitMapper.updateByPrimaryKey(pointlimit);
            System.out.println(pointlimit + "这是什么东西");
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String deletePointLimitInfo(Integer mkey) {

        try {
            System.out.println(pointlimitMapper.selectByPrimaryKey(mkey) + "现在还没有执行" + mkey);
            pointlimitMapper.deleteByPrimaryKey(mkey);
            System.out.println(pointlimitMapper.selectByPrimaryKey(mkey) + "方法已经执行啦");
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("SHIBAI啦");
            return "error";
        }


    }

    @Override
    public String deleteCheckInfo(int checkId) {
        try {
            contractchecktaskMapper.deleteByPrimaryKey(checkId);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public Object getLimitPoint(int curPage, int pageSize) {

        PageHelper.startPage(curPage, pageSize);

        List<Pointlimit> list = pointlimitMapper.selectAll();
        PageInfo result = new PageInfo(list);
        return result;

    }

    @Override
    public Object getTest(Integer equipId) {
        System.out.println("测试访问");
        return equipinfoMapper.selectByPrimaryKey(equipId);
    }

    @Override
    public List<Object> getClientByType(String clientType) {
        return contractinfoMapper.getClientByType(clientType);
    }

    @Override
    public String saveCheckResultEdit(int mkey, int fifthId, int sixthId, String riskPoint, String suggestion, String picName) {
        try {
            Problemcollect problemcollect = new Problemcollect();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date = new Date(System.currentTimeMillis());
            problemcollect.setLastEditTime(formatter.format(date));
            problemcollect.setMkey(mkey);
            problemcollect.setFifthId(fifthId);
            problemcollect.setSixthId(sixthId);
            problemcollect.setRiskPoint(riskPoint);
            problemcollect.setSuggestion(suggestion);
            problemcollect.setPicName(picName);
            problemcollectMapper.updateByPrimaryKeySelective(problemcollect);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String saveBack(int checkId) {
        try {
            ContractCheckTask contractchecktask = new ContractCheckTask();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date = new Date(System.currentTimeMillis());
            contractchecktask.setLastEditTime(formatter.format(date));
            contractchecktask.setCheckId(checkId);
            contractchecktask.setIsFinish("N");
            contractchecktaskMapper.updateByPrimaryKeySelective(contractchecktask);
            Noproblemitem noproblemitem = new Noproblemitem();
            noproblemitem.setCheckId(checkId);
            noproblemitem.setReserve1("N");
            noproblemitemMapper.updateByPrimaryKeySelective(noproblemitem);
            Uncheckeditems uncheckeditems = new Uncheckeditems();
            uncheckeditems.setCheckId(checkId);
            uncheckeditems.setReserve1("N");
            uncheckeditemsMapper.updateByPrimaryKeySelective(uncheckeditems);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public String uploadReport(int checkId, String docxName) {
        try {
            ContractCheckTask contractchecktask = new ContractCheckTask();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date = new Date(System.currentTimeMillis());
            contractchecktask.setLastEditTime(formatter.format(date));
            contractchecktask.setCheckId(checkId);
            contractchecktask.setSummaryReport(docxName);
            contractchecktaskMapper.updateByPrimaryKeySelective(contractchecktask);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error1";
        }
    }

    @Override
    public String getDownLoadUrlByCheckId(int checkId) {
        String result = (contractchecktaskMapper.getDownloadNameByCheckId(checkId) == "" ||
                contractchecktaskMapper.getDownloadNameByCheckId(checkId) == null) ? "error" :
                urlProperties.getAddress() + "/upload/docx/" + contractchecktaskMapper.getDownloadNameByCheckId(checkId);
        //String result = (contractchecktaskMapper.getDownloadNameByCheckId(checkId) == "" || contractchecktaskMapper.getDownloadNameByCheckId(checkId) == null) ? "error" : "http://localhost:8080/docx/" + contractchecktaskMapper.getDownloadNameByCheckId(checkId) + ".doc";
        return result;
    }

    @Override
    public String deleteProblemCollect(int mkey) {
        try {
            problemcollectMapper.deleteByPrimaryKey(mkey);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }

    @Override
    public Object getUncheckInfo(int fourthId, int checkId, boolean isNew) {
        List<Object> list = new ArrayList<>();
        Map<String, Object> map = new HashMap<String, Object>();
        List<Object> uncheckedList = new ArrayList<Object>();
        List<Integer> wsjList = isNew ? newPrefixSystemMapper.getWSJList(checkId, fourthId) : prefixsystemMapper.getWSJList(checkId, fourthId);
        for (int j = 0; j < wsjList.size(); j++) {
            Map<String, Object> map1 = new HashMap<String, Object>();
            String unCheckedpName6 = isNew ? newPrefixSystemMapper.getName4ByName4Id(wsjList.get(j)) : prefixsystemMapper.getName4ByName4Id(wsjList.get(j));
            int unCheckedFifthId = isNew ? newPrefixSystemMapper.getFather(wsjList.get(j)).getPreNum() : prefixsystemMapper.getFather(wsjList.get(j)).getPreNum();
            String unCheckedpName5 = isNew ? newPrefixSystemMapper.getName4ByName4Id(unCheckedFifthId) : prefixsystemMapper.getName4ByName4Id(unCheckedFifthId);
            map1.put("pName56", unCheckedpName6 + "(" + unCheckedpName5 + ")");
            map1.put("point", isNew ? newPrefixSystemMapper.getPoint4ByPoint4Id(wsjList.get(j)) : prefixsystemMapper.getPoint4ByPoint4Id(wsjList.get(j)));
            map1.put("type", "未涉及问题");
            uncheckedList.add(map1);
        }
        List<Uncheckeditems> uncheckeditemsList = uncheckeditemsMapper.getAllUncheckedInfoByFourthId(checkId, fourthId);
        for (int i = 0; i < uncheckeditemsList.size(); i++) {
            Map<String, Object> map2 = new HashMap<String, Object>();
            String unCheckedpName6 = isNew ? newPrefixSystemMapper.getName4ByName4Id(uncheckeditemsList.get(i).getSixthId()) : prefixsystemMapper.getName4ByName4Id(uncheckeditemsList.get(i).getSixthId());
            int unCheckedFifthId = isNew ? newPrefixSystemMapper.getFather(uncheckeditemsList.get(i).getSixthId()).getPreNum() : prefixsystemMapper.getFather(uncheckeditemsList.get(i).getSixthId()).getPreNum();
            String unCheckedpName5 = isNew ? newPrefixSystemMapper.getName4ByName4Id(unCheckedFifthId) : prefixsystemMapper.getName4ByName4Id(unCheckedFifthId);
            map2.put("pName56", unCheckedpName6 + "(" + unCheckedpName5 + ")");
            map2.put("point", isNew ? newPrefixSystemMapper.getPoint4ByPoint4Id(uncheckeditemsList.get(i).getSixthId()) : prefixsystemMapper.getPoint4ByPoint4Id(uncheckeditemsList.get(i).getSixthId()));
            map2.put("type", "没有问题");
            uncheckedList.add(map2);
        }
        //获取应得分数，实得分数和最终得分
        List<ProblemCollectDetail> sixthPoints = isNew ? newProblemCollectDetailMapper.getsixthPoints(checkId, fourthId) : problemCollectDetailMapper.getsixthPoints(checkId, fourthId);
        String pointName6Info = JSON.toJSONString(sixthPoints, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray sixthPointsArray = JSONArray.parseArray(pointName6Info);
        double calculatePoint6 = 0;
        double calculatePoint66 = 0;
        double calculateTruePoint = 0;
        for (int y = 0; y < sixthPointsArray.size(); y++) {
            JSONObject sixPointObject = sixthPointsArray.getJSONObject(y);
            int deductSixthId = sixPointObject.getIntValue("sixthId");
            float deductPointsSumFloat = isNew ? newProblemCollectDetailMapper.getdeductSum(checkId, deductSixthId) : problemCollectDetailMapper.getdeductSum(checkId, deductSixthId);
            double deductPointsSum = Double.valueOf(String.valueOf(deductPointsSumFloat));
            double truePoint = Double.parseDouble(sixPointObject.getString("point6"));
            if (truePoint <= deductPointsSum) {
                calculatePoint66 = 0;
            } else {
                calculatePoint66 = truePoint - deductPointsSum;
            }
            calculateTruePoint += truePoint;
            calculatePoint6 += calculatePoint66;
        }
        double noProblemPoint = 0;
        List<Object> noProblemSixthIdList = uncheckeditemsMapper.getNoProblemSixthId(checkId, fourthId);
        String noProblemSixthIdInfo = JSON.toJSONString(noProblemSixthIdList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray noProblemSixthArray = JSONArray.parseArray(noProblemSixthIdInfo);
        for (int m = 0; m < noProblemSixthArray.size(); m++) {
            int noProblemSixthId = noProblemSixthArray.getIntValue(m);
            double noProblem = Double.parseDouble(isNew ? newPrefixSystemMapper.getPoint4ByPoint4Id(noProblemSixthId) : prefixsystemMapper.getPoint4ByPoint4Id(noProblemSixthId));
            noProblemPoint += noProblem;
        }
        System.out.println("第六级扣过的分数总分:" + calculatePoint6 + "没有问题的总分:" + noProblemPoint + "第六级总分:" + calculateTruePoint);
        double checkItemPoint = (calculatePoint6 + noProblemPoint) / (calculateTruePoint + noProblemPoint) * 100;
        List<ProblemCollectDetail> checkItemCalcuList = isNew ? newProblemCollectDetailMapper.getAllFourthInfo(checkId, fourthId) : problemCollectDetailMapper.getAllFourthInfo(checkId, fourthId);
        String maxFourthRiskPoint = pointsCalculate.getMaxRiskPoint(checkItemCalcuList);
        int maxFourthRiskPointNum = isNew ? newProblemCollectDetailMapper.getRiskPointCount(checkId, fourthId, maxFourthRiskPoint) : problemCollectDetailMapper.getRiskPointCount(checkId, fourthId, maxFourthRiskPoint);
        double limitFourhPoint = Double.parseDouble((pointlimitMapper.getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint)) == null ? "100" : pointlimitMapper.getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint));
        if (checkItemPoint > limitFourhPoint) {
            checkItemPoint = limitFourhPoint;
        }
        DecimalFormat df = new DecimalFormat("0.00");
        String fourthPoint = df.format(checkItemPoint);
        String ideaPoint = df.format(calculateTruePoint + noProblemPoint);
        String realPoint = df.format(calculatePoint6 + noProblemPoint);
        map.put("fourthPoint", fourthPoint);
        map.put("ideaPoint", ideaPoint);
        map.put("realPoint", realPoint);
        map.put("pName4", isNew ? newPrefixSystemMapper.getName4ByName4Id(fourthId) : prefixsystemMapper.getName4ByName4Id(fourthId));
        map.put("unCheckedList", uncheckedList);
        list.add(map);
        return list;
    }

    @Override
    public List<Object> findAllInfo(Integer checkId) {
        List<Object> list = contractchecktaskMapper.findAllInfo(checkId);
        return list;
    }

    //返回examineInfo中table的信息，包括PCD表和检查人（userName）
    @Override
    public List<PCDandUSERNAME> findPCDInfo(Integer checkId, Integer fourthId) {
        List<PCDandUSERNAME> list = contractchecktaskMapper.findPCDInfo(checkId, fourthId);
        return list;
    }

    @Override
    public Object examineProblem(Integer checkId) {
        try {
            ContractCheckTask contractchecktask = new ContractCheckTask();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
            Date date = new Date(System.currentTimeMillis());
            contractchecktask.setLastEditTime(formatter.format(date));
            contractchecktask.setCheckId(checkId);
            contractchecktask.setIsExamine("Y");
            contractchecktaskMapper.updateByPrimaryKeySelective(contractchecktask);
            return "success";
        } catch (Exception e) {
            return e;
        }
    }

    @Override
    public Object qualifyExamine(Integer checkId) {
        Integer obj = contractchecktaskMapper.qualifyExamine(checkId);
        if (obj == 0) {
            return "success";
        } else {
            return "error";
        }
    }

    //返回examineInfo中第二级collapse中显示的第四级名称
    @Override
    public List<Node4PName1VO> Getnode4nameBycheckId(Integer checkId) {
        List<Node4PName1VO> node4name = contractchecktaskMapper.Getnode4nameBycheckId(checkId);
        node4name.stream()
                .sorted(Comparator.comparing(Node4PName1VO::getFirstId))
                .collect(Collectors.toList());
        return node4name;

    }

    @Override
    public List<Summary> getSummary(Integer checkId, Integer fourthId) {
        return summaryMapper.getSummaryInfoByFourthId(checkId, fourthId);
    }

    @Override
    public List<ParPrefixSystem> findSixthName(Integer fourthId) {
        List<ParPrefixSystem> list = prefixParSystemMapper.getSixthNameByFourthId(fourthId);
        return list;
    }

    @Override
    public List<ProblemDescription> findProblemDesBySixthId(Integer sixthId) {
        return newproblemdescriptionMapper.getLastLevel(sixthId);
    }

    @Override
    public List<ProblemNumVO> findProblemNumByLastId(Integer lastId) {
        List<ProblemNumVO> list = new ArrayList<>();
        String problemNum = "";
        int size = 1;

        List<ProblemDescription> all = newproblemdescriptionMapper.findAllByNumber(lastId);
        for (ProblemDescription npd : all) {
            problemNum = npd.getProblemNum();
            for (int i = 0; i < problemNum.length(); i++) {
                if (problemNum.charAt(i) == ';') {
                    size++;
                }
            }
        }
        String[] problemArray = new String[size];
        problemArray = problemNum.split(";");

        for (int i = 0; i < problemArray.length; i++) {
            ProblemNumVO problemNumVO = new ProblemNumVO(i + 1, problemArray[i]);
            list.add(problemNumVO);
        }
        return list;
    }

    @Override
    public boolean problemCollectUpdate(Integer mkey, Integer fifthId, Integer sixthId, String remark, String suggestion, String problemQua, String picName, String checkPart, Integer lastId,Integer isNew) {
        Problemcollect pc = new Problemcollect(mkey, fifthId, sixthId, lastId, picName, checkPart, remark, suggestion, problemQua,isNew);

        int isSuccess = problemcollectMapper.updateByPrimaryKeySelective(pc);
        if (isSuccess == 1) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean newProblemDesUpdate(Integer number, String riskNumber) {
        ProblemDescription npd = new ProblemDescription(number, riskNumber);
        int isSuccess = newproblemdescriptionMapper.updateByPrimaryKeySelective(npd);
        if (isSuccess == 1) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean corrspondScaleUpdate(Integer mkey, Integer lastId, String correspondScale,Integer isNew) {
        int pnSize = 0, prSize = 0, riskNumber = 0;
        String riskPoint = "";

        String pcProblemQua = problemcollectMapper.findProblemQuaByMkeyAndLastId(mkey, lastId);
        List<ProblemDescription> npdList = newproblemdescriptionMapper.findAllByNumber(lastId);

        for (ProblemDescription npd : npdList) {
            String problemNum = npd.getProblemNum();
            pnSize = getSize(problemNum);

            String problemRn = npd.getProblemRn();
            prSize = getSize(problemRn);
            //获取riskNumber
            riskNumber = Integer.parseInt(npd.getRiskNumber());
        }
        //分割problemNum problemRn
        String[] problemNumArray = new String[pnSize];
        String[] problemRnArray = new String[prSize];
        for (ProblemDescription npd : npdList) {
            String problemNum = npd.getProblemNum();
            String problemRn = npd.getProblemRn();
            problemNumArray = problemNum.split(";");
            problemRnArray = problemRn.split(";");
        }
        //字符串比较
        List<String> problemNumList = Arrays.asList(problemNumArray);
        int[] indexArray = ListUtil.indexOfAll(problemNumList, pcProblemQua::equals);
        //取出Rn
        Double Rn = Double.parseDouble(problemRnArray[indexArray[0]]);
        //计算l
        Double L = Integer.parseInt(correspondScale) * Rn * riskNumber;
        if (24 < L) {
            riskPoint = "4";
        } else if (12 < L && L <= 24) {
            riskPoint = "3";
        } else if (4 < L && L <= 12) {
            riskPoint = "2";
        } else if (L <= 4) {
            riskPoint = "1";
        }

        Problemcollect pc = new Problemcollect(mkey, riskPoint);
        int isPcUpdateSuccess = problemcollectMapper.updateByPrimaryKeySelective(pc);

        Problemcollect pcUpdateCorrespondScale = new Problemcollect();
        pcUpdateCorrespondScale.setLastId(lastId);
        pcUpdateCorrespondScale.setCorrespondScale(correspondScale);
        pcUpdateCorrespondScale.setIsNew(isNew);
        pcUpdateCorrespondScale.setMkey(mkey);
        int isPcUpdateCorSuccess = problemcollectMapper.updateByPrimaryKeySelective(pcUpdateCorrespondScale);
        if (isPcUpdateSuccess == 1 && isPcUpdateCorSuccess == 1) {
            return true;
        } else {
            return false;
        }
    }

    public Integer getSize(String str) {
        int count = 1;
        for (Character ch : str.toCharArray()) {
            if (ch.equals(';')) {
                count++;
            }
        }
        return count;
    }

    @Override
    public List<PCDandUSERNAME> findPCDInfoAfterUpdate(Integer checkId, Integer fourthId) {
        List<PCDandUSERNAME> list = contractchecktaskMapper.findPCDInfoAfterUpdate(checkId, fourthId);
        return list;
    }

    @Override
    public String saveEditInfo(int mkey, String riskPoint, String suggestion, String picName) {
        Problemcollect problemcollect = problemcollectMapper.selectByPrimaryKey(mkey);
        if (null != problemcollect) {
            problemcollect.setRiskPoint(riskPoint);
            problemcollect.setSuggestion(suggestion);
            problemcollect.setPicName(picName);
            problemcollectMapper.updateByPrimaryKeySelective(problemcollect);
            return "success";
        }
        return "error";
    }

    /**
     * @author： wenyihan
     * @description：判断新老体系，新体系返回true、老体系返回false
     * @date： 20:16 2020/12/13
     * @param： [checkId]
     * @return： java.lang.Boolean
     */
    @Override
    public Boolean judgeNewOrOldSystem(int checkId) {
        int problemNum = problemcollectMapper.selectProblemNumByCheckId(checkId);
        if (problemNum == 0) {
            return false;
        } else {
            return true;
        }
    }

    /**
     * @author： wenyihan
     * @description：通过fourthID获取第五级名称+number
     * @date： 23:44 2020/12/15
     * @param： [fourthId]
     * @return： java.util.List<com.whut.v_vo.oldSysPreListVO>
     */
    @Override
    public List<oldSysPreListVO> getpNameByUpperId(int preNum) {
        List<oldSysPreListVO> pName5List = prefixParSystemMapper.getpNameByUpperId(preNum);
        return pName5List;
    }

    /**
     * @author： wenyihan
     * @description：通过上级id找到最后一级的pd，np，pn
     * @date： 12:58 2020/12/17
     * @param： [preNum]
     * @return： java.util.List<com.whut.v_vo.oldSysLastListVO>
     */
    @Override
    public List<oldSysLastListVO> getLastListByUpperId(int preNum) {
        List<oldSysLastListVO> lastList = problemdescriptionMapper.getLastListByUpperId(preNum);
        return lastList;
    }

    /**
     * @author： wenyihan
     * @description：//TODO
     * @date： 19:44 2020/12/17
     * @param： [mKey, fifthId, sixthId, lastId, problemQua, suggestion, pic]
     * @return： java.lang.Boolean
     */
    @Override
    public Boolean oldSysUpdate(Integer mKey, Integer fifthId, Integer sixthId, Integer lastId, String problemQua, String suggestion, String pic, String riskPoint) {
        //更新pc表
        Problemcollect problemcollect = new Problemcollect();
        problemcollect.setMkey(mKey);
        problemcollect.setFifthId(fifthId);
        problemcollect.setSixthId(sixthId);
        problemcollect.setLastId(lastId);
        problemcollect.setPicName(pic);
        problemcollect.setSuggestion(suggestion);
        problemcollect.setProblemQua(problemQua);
        problemcollect.setRiskPoint(riskPoint);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
        format.setTimeZone(TimeZone.getTimeZone("CST"));
        problemcollect.setLastEditTime(format.format(new Date()));

        int pcUpdate = problemcollectMapper.updateByPrimaryKeySelective(problemcollect);
        System.out.println(pcUpdate);
        return pcUpdate != 0;
    }

    @Override
    public String calculateRiskPoint(Integer lastId, String problemQua) {
        //根据新的problemQua获取新的riskPoint
        String riskPoint = "";
        List<ProblemDescription> lastList = problemdescriptionMapper.getLastListByLastId(lastId);
        String problemNumTemp = "";
        String riskPointTemp = "";
        for (ProblemDescription pd : lastList) {
            problemNumTemp = pd.getProblemNum();
            riskPointTemp = pd.getRiskLevel();
        }
        String[] problemNumArray = problemNumTemp.split(";");
        String[] riskPointArray = riskPointTemp.split(";");
        for (int i = 0; i < problemNumArray.length; i++) {
            if (problemNumArray[i].equals(problemQua)) {
                riskPoint = riskPointArray[i];
            }
        }
        return riskPoint;
    }

    @Override
    public String editSummary(Integer mKey, String summary) {
        Summary s = new Summary();
        s.setMkey(mKey);
        s.setSummary(summary);
        int res = summaryMapper.updateByPrimaryKey(s);
        if (res == 0) {
            return "false";
        } else {
            return "success";
        }
    }

    @Override
    public String insertSummary(Integer checkId, Integer fourthId, String summary, Integer firstId) {
        Summary s = new Summary(checkId, fourthId, "Y", summary, firstId);
        int res = summaryMapper.insertSelective(s);
        if (res == 0) {
            return "false";
        } else {
            return "success";
        }
    }

    @Override
    public List<oldSysExamInfoVO> getOldSysFourthInfo(Integer checkId, Integer fourthId) {
        List<oldSysExamInfoVO> list = problemCollectDetailMapper.getOldSysFourthInfo(checkId, fourthId);
        return list;
    }

    @Override
    public String newHiddenCheckReport(int projectId, int checkId, boolean isNew) throws UnsupportedEncodingException {
        ParSystemMapper parSystemMapper = isNew ? newPrefixSystemMapper : prefixParSystemMapper;
        ParProblemDescriptionMapper parProblemDescriptionMapper = isNew ? newproblemdescriptionMapper : problemdescriptionMapper;
        ParProblemCollectDetailMapper parProblemCollectDetailMapper = isNew ? newProblemCollectDetailMapper : problemCollectDetailMapper;

        return new NewHiddenCheckReport(parSystemMapper,
                parProblemDescriptionMapper,
                parProblemCollectDetailMapper,
                this,
                reportServiceImpl,
                mapperUtils,
                urlProperties,
                profiles).generateReport(projectId, checkId, isNew);

    }

    @Override
    public boolean getIsNew(int checkId) {
        return problemcollectMapper.getIsNew(checkId) > 0 ? true : false;
    }


    public void initProjectSummaryFirstPart(int projectId, Map<String, Object> dataMap) {
        ContractTaskProject contractTaskProject = contractTaskProjectMapper.selectAllByProjectId(projectId);
        if (contractTaskProject != null) {
            dataMap.put("projectName", contractTaskProject.getProjectName());
            dataMap.put("projectAddress", contractTaskProject.getArea());
            dataMap.put("jsUnit", contractTaskProject.getJsUnit());
            dataMap.put("jlUnit", contractTaskProject.getJlUnit());
            dataMap.put("sgUnit", contractTaskProject.getSgUnit());
            dataMap.put("projectType", contractTaskProject.getProjectType());
            dataMap.put("projectPrice", contractTaskProject.getProjectPrice());
            dataMap.put("dangerItem", contractTaskProject.getDangerItem());
            dataMap.put("remark", contractTaskProject.getRemark());
            dataMap.put("projectDescription", contractTaskProject.getProjectDescription());
            dataMap.put("jsUniter", contractTaskProject.getJsUniter());
            dataMap.put("jlUniter", contractTaskProject.getJlUniter());
            dataMap.put("sgUniter", contractTaskProject.getManager());
        }
    }
}
